import { post } from '@/request/http'
import { toString } from '@/utils/utils'

/**
 * 平台管理--角色管理 接口
 *
 */

/**
 * 获取列表数据
 */

export const checkRoleList = data =>
  post(
    '/FTKJWLHYPT/platform/queryRole',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rleCode: '',
            rleName: data.roleName,
            rleType: data.roleStyle
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: toString(data.PageIndexs)
        },
        PageSizes: {
          FTKJWLHYPT: toString(data.PageSizes)
        }
      }
    }
  )
/**
 * 新增一行数据
 */

export const addRoleList = data =>
  post(
    '/FTKJWLHYPT/platform/addRole',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rleCode: data.roleCode,
            rleName: data.roleName,
            rleRemark: data.note,
            rleIsp: data.manageRole,
            // rleOrder: '',
            rleType: data.roleStyle
          }
        }
      }
    }
  )
/**
 * 编辑一行数据
 */
export const editRoleList = data =>
  post(
    '/FTKJWLHYPT/platform/editRole',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rleId: data.rleId,
            rleCode: data.roleCode,
            rleName: data.roleName,
            rleRemark: data.note,
            rleIsp: data.manageRole,
            // rleOrder: '',
            rleType: data.roleStyle
          }
        }
      }
    }
  )
/**
 * 删除一行数据
 */
export const delRoleList = data =>
  post(
    '/FTKJWLHYPT/platform/deleteRole',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rleId: data.rleId
          }
        }
      }
    }
  )
/**
 * 角色类型下拉接口
 */

export const getRoleDown = () =>
  post(
    '/FTKJWLHYPT/base/getRefCodesByType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain: '角色类型',
            rvTerId: -1,
          }
        }
      }
    }
  )
